import time

from selenium.webdriver.common.by import By

from weixin_po.commom.BasePage import BasePage
from weixin_po.utils.log_util import logger


class personnellist(BasePage):
    _phone_list = (By.XPATH, "//tr//td[5]")

    def get_phone_list(self):
        self.wait_for_ele_to_be_visible(By.XPATH, "//tr//td[5]")
        elements = self.finds(self._phone_list)
        results = [element.text for element in elements]
        return results

    def del_mem(self, phone):
        self.driver.implicitly_wait(3)
        self.find(By.XPATH, f"//span[text()='{phone}']/../..//input").click()
        self.driver.implicitly_wait(2)
        logger.info(f"//span[text()='{phone}']/../..//input")
        self.find(By.XPATH, "//*[text()='删除']").click()
        time.sleep(2)
        self.wait_for_ele_to_be_click(By.XPATH, "//a[@class='qui_btn ww_btn ww_btn_Blue']")


